// main.js (主线程)
const worker = new Worker("worker.js");
console.log(worker);
setTimeout(() => {
  worker.postMessage(2);
}, 1000);

worker.onmessage = function (e) {
  console.log("Received:", e.data);
};

// 主线程
// worker.terminate(); // 终止 worker 线程
